package com.dailyblue.java.project.bookstore.util;

/**
 * @Author: Dailyblue
 * @Description: 返回体构造工具
 * @Date Create in 2022/06/21 19:28
 */
public class ResultTool {
    public static JsonResult success() {
        return new JsonResult(true);
    }

    public static <T> JsonResult<T> success(T data) {
        return new JsonResult(true, data);
    }

    public static JsonResult fail() {
        return new JsonResult(false);
    }

    public static JsonResult fail(String errorMsg) {
        return new JsonResult(false, errorMsg);
    }

    public static JsonResult fail(ResultCode resultEnum) {
        return new JsonResult(false, resultEnum);
    }

    public static JsonResult fail(int code, String message) {
        return new JsonResult(false, code, message);
    }
}